#include <iostream>
#include <windows.h>

// 动态加载
typedef int (*AddFunction)(int, int);

int main() {
    HINSTANCE hDLL = LoadLibrary("dyAdd.dll");
    if (hDLL != NULL) {
        AddFunction add = (AddFunction)GetProcAddress(hDLL, "add");
        if (add != NULL) {
            int result = add(3, 5);
            std::cout << "3 + 5 = " << result << std::endl;
        }
        else {
            std::cout << "Failed to get add function address." << std::endl;
        }
        FreeLibrary(hDLL);
    }
    return 0;
}